﻿/*
 * Copyright © 2011 Tristan Reeves, treeves@gmail.com
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
using Sprinkles.Tests.TestClasses;

namespace Sprinkles.Tests.DeploymentHosts
{
    public class DummyHost2 : DeploymentHost
    {
        private string Qualify(string name)
        {
            return "DummyHost2." + name;
        }

        protected override void RegisterDeployments()
        {
            Register<ConstructorTest1>()
                .Name(Qualify("constructor1.obj.2"))
                .CreatedBy.Constructor((int x, object o) => new ConstructorTest1(x, o))
                    .SetLiteral(5)
                    .SetLiteral(new object()).
                Done();

            Register<ConstructorTest1>()
                .Name(Qualify("constructor1.exp.2"))
                .CreatedBy.Constructor((int x, object o) => new ConstructorTest1(x, o))
                    .SetExpression("77+33")
                    .SetLiteral(22).
                Done();

            Register<ConstructorTest1>()
                .Name(Qualify("constructor1.ph.2"))
                .CreatedBy.Constructor((int x, object o) => new ConstructorTest1(x, o))
                    .SetLiteral(88)
                    .SetPlaceholder("${x}").
                Done();

            Register<ConstructorTest2>()
                .Name(Qualify("constructor2.ref.2"))
                .CreatedBy.Constructor((ConstructorTest1 x, object o) => new ConstructorTest2(x, o))
                    .SetReference("DummyHost.constructor1.obj")
                    .SetReference(Qualify("constructor1.obj.2")).
                Done();
        }

        protected override bool Include
        {
            get { return (UserContext == "construction-config-1") && ALLOW; }
        }
        public static bool ALLOW = true;
    }
}
